window.onload = function () {

    window.onclick = function () {
        return false;
    }
    // 获取元素 input button
    let inps = document.querySelectorAll('form input');
    let but = document.querySelector('form button')
    console.log(inps, but);
    but.onclick = function () {
        let users = inps[0].value;
        let pass = inps[1].value;
        let obj = {
            "username": users,
            "password": pass
        };
       
        let s =persons.filter(function (item, index) {
            if ((item.username == obj.username && item.password == obj.password)||(localStorage.username==obj.username && localStorage.password == obj.password)) {
                return item
            }
        })
        if (s.length >= 1) {
            alert('登录成功')
            location.href = './index.html'
        } else {
            alert('您输入的账号和密码有误')
            location.href = './register.html';
        };


    }











}